#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# desc: sendmail
import smtplib
from email.mime.text import MIMEText
class SendMail():
    def __init__(self):
        self.__mail_host='smtp.qq.com'
        self.__mail_port='465'
        self.__mail_user='2399447849'
        self.__mail_pass='xxx'
        self.__mail_postfix='qq.com'

    def send_mail(self,to_list,sub,content):
        me="BlueKingAdmin"+"<"+self.__mail_user+"@"+self.__mail_postfix+">"
        msg = MIMEText(content,_subtype='html',_charset='gb2312')
        msg['Subject'] = sub
        msg['From']=me
        msg['to']=";".join(to_list)
        s = smtplib.SMTP_SSL()
        s.connect(self.__mail_host)
        s.login(self.__mail_user,self.__mail_pass)
        s.sendmail(me,to_list,msg.as_string())
        s.close()




